import { Table, Input, Form, Button } from 'antd';
import React from 'react';
import './index.less'
const columns = [
  {
    title: 'Name',
    dataIndex: 'name',
  },
  {
    title: 'Age',
    dataIndex: 'age',
    defaultSortOrder: 'descend',
  },
  {
    title: () => (
      <div className='address'>
        <div>address</div>
        <Form.Item name="address">
          <Input />
        </Form.Item>
      </div>
    ),
    dataIndex: 'address',
  },
];
const data = [
  {
    key: '1',
    name: 'John Brown',
    age: 32,
    address: 'New York No. 1 Lake Park',
  },
  {
    key: '2',
    name: 'Jim Green',
    age: 42,
    address: 'London No. 1 Lake Park',
  },
  {
    key: '3',
    name: 'Joe Black',
    age: 32,
    address: 'Sidney No. 1 Lake Park',
  },
  {
    key: '4',
    name: 'Jim Red',
    age: 32,
    address: 'London No. 2 Lake Park',
  },
];
const onChange = (pagination, filters, sorter, extra) => {
  console.log('params', pagination, filters, sorter, extra);
};
const Index = () => {
  const [form] = Form.useForm();
  const handleSubmit = () => {
    console.log(form.getFieldsValue())
  }
  return (
    <Form
      form={form}
    >
      <Table
        columns={columns}
        dataSource={data}
        onChange={onChange}
        size='small'
      />
      <Button onClick={handleSubmit}>点击提交</Button>
    </Form>
  )
}
export default Index;